import type { UserFriendVO } from './models';

import type { ID, IDS, PageQuery } from '#/api/common';

import { requestClient } from '#/api/request';

enum Api {
  root = '/system/user/friend',
  userFriendList = '/system/user/friend/list',
  userFriendSelect = '/system/user/friend/optionselect',
}

/**
 * 获取用户状态列表
 * @param params 参数
 * @returns UserFriendVO[]
 */
export function userFriendList(params?: PageQuery) {
  return requestClient.get<UserFriendVO[]>(Api.userFriendList, { params });
}

/**
 * 查询用户状态信息
 * @param userFriendId id
 * @returns 用户状态信息
 */
export function userFriendInfo(userFriendId: ID) {
  return requestClient.get<UserFriendVO>(`${Api.root}/${userFriendId}`);
}

/**
 * 用户状态新增
 * @param data 参数
 * @returns void
 */
export function userFriendAdd(data: Partial<UserFriendVO>) {
  return requestClient.postWithMsg<void>(Api.root, data);
}

/**
 * 用户状态更新
 * @param data 参数
 * @returns void
 */
export function userFriendUpdate(data: Partial<UserFriendVO>) {
  return requestClient.putWithMsg<void>(Api.root, data);
}

/**
 * 用户状态删除
 * @param userFriendIds ids
 * @returns void
 */
export function userFriendRemove(userFriendIds: IDS) {
  return requestClient.deleteWithMsg<void>(`${Api.root}/${userFriendIds}`);
}
